ostree.git
6 years agotests: Skip /var test if running with systemd and libmount
Alex Kiernan [Sun, 29 Dec 2019 13:25:24 +0000 (13:25 +0000)]
tests: Skip /var test if running with systemd and libmount

If running with systemd and libmount then /var mounting is deferred for
systemd. Skip the relevant tests in this case as it will always fail.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agobuild: Expose systemd in OSTREE_FEATURES
Alex Kiernan [Sun, 29 Dec 2019 13:23:23 +0000 (13:23 +0000)]
build: Expose systemd in OSTREE_FEATURES

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotest-switchroot.sh: Exclude /proc from file list
Alex Kiernan [Sun, 29 Dec 2019 12:32:28 +0000 (12:32 +0000)]
test-switchroot.sh: Exclude /proc from file list

Since we're not interested in any file inside /proc, exclude it from the
file listing in our fake root thus avoiding failures when processes die
during our execution and find(1) can't then look inside those
directories.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoMerge pull request #1767 from cgwalters/sysroot-mnt-namespace
OpenShift Merge Robot [Wed, 11 Dec 2019 20:34:36 +0000 (21:34 +0100)]
Merge pull request #1767 from cgwalters/sysroot-mnt-namespace

Support mounting /sysroot (and /boot) read-only

6 years agoSupport mounting /sysroot (and /boot) read-only
Colin Walters [Wed, 3 Oct 2018 14:57:19 +0000 (14:57 +0000)]
Support mounting /sysroot (and /boot) read-only

We want to support extending the read-only state to cover `/sysroot`
and `/boot`, since conceptually all of the data there should only
be written via libostree.  Or at least for `/boot` should *mostly*
just be written by ostree.

This change needs to be opt-in though to avoid breaking anyone.

Add a `sysroot/readonly` key to the repository config which instructs
`ostree-remount.service` to ensure `/sysroot` is read-only.  This
requires a bit of a dance because `/sysroot` is actually the same
filesystem as `/`; so we make `/etc` a writable bind mount in this case.

We also need to handle `/var` in the "OSTree default" case of a bind
mount; the systemd generator now looks at the writability state of
`/sysroot` and uses that to determine whether it should have the
`var.mount` unit happen before or after `ostree-remount.service.`

Also add an API to instruct the libostree shared library
that the caller has created a new mount namespace.  This way
we can freely remount read-write.

This approach extends upon in a much better way previous work
we did to support remounting `/boot` read-write.

Closes: https://github.com/ostreedev/ostree/issues/1265
6 years agofinalize-staged: Use the core option parsing to load sysroot
Colin Walters [Thu, 5 Sep 2019 00:52:15 +0000 (00:52 +0000)]
finalize-staged: Use the core option parsing to load sysroot

Prep for using the default mount namespace handling there that
will land as part of the read-only `/sysroot` and `/boot` work.
See https://github.com/ostreedev/ostree/issues/1265

6 years agoMerge pull request #1981 from cgwalters/release-2019.6
OpenShift Merge Robot [Mon, 9 Dec 2019 19:26:55 +0000 (14:26 -0500)]
Merge pull request #1981 from cgwalters/release-2019.6

Release 2019.6

6 years agoPost-release version bump
Colin Walters [Mon, 9 Dec 2019 16:18:28 +0000 (16:18 +0000)]
Post-release version bump

6 years agoRelease 2019.6
Colin Walters [Mon, 9 Dec 2019 16:10:50 +0000 (16:10 +0000)]
Release 2019.6

Nothing really big here, but let's get a release out
so some bigger things like ro-sysroot, signing, sizes can
bake in master for a bit.

6 years agoMerge pull request #1221 from cgwalters/pull-basic-auth
OpenShift Merge Robot [Tue, 3 Dec 2019 14:41:08 +0000 (06:41 -0800)]
Merge pull request #1221 from cgwalters/pull-basic-auth

    pull: Add support for basic auth

6 years agopull: Add support for basic auth
Colin Walters [Wed, 27 Sep 2017 02:02:25 +0000 (22:02 -0400)]
pull: Add support for basic auth

This has been requested a few times for people delivering
OSTree content and wanting to do access control.

6 years agoMerge pull request #1980 from ssssam/sam/readme-buildstream-tweak
OpenShift Merge Robot [Mon, 2 Dec 2019 13:10:18 +0000 (14:10 +0100)]
Merge pull request #1980 from ssssam/sam/readme-buildstream-tweak

README.md: Tweak text about BuildStream

6 years agoREADME.md: Tweak text about BuildStream
Sam Thursfield [Sun, 1 Dec 2019 19:43:14 +0000 (20:43 +0100)]
README.md: Tweak text about BuildStream

BuildStream no longer uses libostree internally (see
https://gitlab.com/BuildStream/buildstream/issues/387). It still
has first class support for interoperating with libostree repos.

6 years agoMerge pull request #1978 from agners/fix-build-race
OpenShift Merge Robot [Tue, 26 Nov 2019 12:52:25 +0000 (13:52 +0100)]
Merge pull request #1978 from agners/fix-build-race

Avoid race condition when building outside of source tree

6 years agoAvoid race condition when building outside of source tree
Stefan Agner [Tue, 26 Nov 2019 08:20:30 +0000 (09:20 +0100)]
Avoid race condition when building outside of source tree

When building outside of source tree it can happen that src/ostree/
does not exist (yet) when bison is called. This leads to an build
error like so:
  bison: src/ostree/parse-datetime.c: cannot open: No such file or directory

Make sure that src/ostree/ exists when parse-datetime.c is built.

6 years agoMerge pull request #1976 from cgwalters/repo-finder-test
OpenShift Merge Robot [Mon, 25 Nov 2019 14:26:31 +0000 (15:26 +0100)]
Merge pull request #1976 from cgwalters/repo-finder-test

tests/repo-finder: Run realpath() on /tmp

6 years agotests/repo-finder: Run realpath() on /tmp
Colin Walters [Thu, 21 Nov 2019 18:37:48 +0000 (18:37 +0000)]
tests/repo-finder: Run realpath() on /tmp

This fixes running this test case inside
https://github.com/cgwalters/coretoolbox

6 years agoMerge pull request #1968 from ptomato/ostree-async-progress-copy-state
OpenShift Merge Robot [Thu, 21 Nov 2019 14:14:04 +0000 (15:14 +0100)]
Merge pull request #1968 from ptomato/ostree-async-progress-copy-state

libostree: Add ostree_async_progress_copy_state()

6 years agolibostree: Add ostree_async_progress_copy_state()
Philip Chimento [Mon, 4 Nov 2019 21:21:36 +0000 (13:21 -0800)]
libostree: Add ostree_async_progress_copy_state()

This allows copying the state from one OstreeAsyncProgress object to
another, atomically, without invoking the callback. This is needed in
libflatpak, in order to chain OstreeAsyncProgress objects so that you
can still receive progress updates when iterating a different
GMainContext than the one that the OstreeAsyncProgress object was
created under.

See https://github.com/flatpak/flatpak/pull/3211 for the application of
this API.

6 years agoBump version in symbols file
Philip Chimento [Tue, 5 Nov 2019 18:05:45 +0000 (10:05 -0800)]
Bump version in symbols file

There were no new symbols in 2019.5 and this version didn't get bumped
when 2019.5 was released.

6 years agoMerge pull request #1909 from rfairley/rfairley-kargs-order-entries
OpenShift Merge Robot [Fri, 8 Nov 2019 22:54:12 +0000 (23:54 +0100)]
Merge pull request #1909 from rfairley/rfairley-kargs-order-entries

lib/kernel-args: Store kernel args as key/value entries

6 years agoMerge pull request #1971 from akiernan/us-tests-dir
OpenShift Merge Robot [Fri, 8 Nov 2019 16:08:15 +0000 (17:08 +0100)]
Merge pull request #1971 from akiernan/us-tests-dir

build: create tests directory for split builds

6 years agoMerge pull request #1972 from cgwalters/bump-libglnx-20191108
OpenShift Merge Robot [Fri, 8 Nov 2019 15:26:47 +0000 (16:26 +0100)]
Merge pull request #1972 from cgwalters/bump-libglnx-20191108

Bump libglnx

6 years agoBump libglnx
Colin Walters [Fri, 8 Nov 2019 13:36:23 +0000 (13:36 +0000)]
Bump libglnx

This has a few fixes, mainly I want to get this in
as prep for fs-verity.

Update submodule: libglnx

```
Alex Kiernan (1):
      macros: Add TEMP_FAILURE_RETRY for musl

Alexander Larsson (1):
      Add glnx_open_anonymous_tmpfile_full() allowing you to specify the directory

Colin Walters (8):
      Merge branch 'shutil-rm-rf-errprefix' into 'master'
      Merge branch 'us-temp-failure-retry' into 'master'
      Merge branch 'anonymous-tmpfile-dir' into 'master'
      Merge branch 'meson-older-compilers' into 'master'
      fdio: Add glnx_tmpfile_reopen_rdonly()
      Merge branch 'reopen-rdonly' into 'master'
      build-sys: Add libglnx-testlib.c to Automake
      Merge branch 'testlib-automake' into 'master'

Jonathan Lebon (1):
      Merge branch 'uchar' into 'master'

Simon McVittie (5):
      missing: Remove unused <uchar.h>
      Run the fdio test in its own temporary directory
      meson: Define HAVE_DECL_FOO to 0 if foo isn't declared
      Make the Meson build work on older compilers
      CI: Target a Fedora stable release

Will Thompson (3):
      Add meson.build files
      Document using this as a Meson subproject
      Add GitLab CI

```

6 years agobuild: create tests directory for split builds
Alex Kiernan [Tue, 5 Nov 2019 22:26:23 +0000 (22:26 +0000)]
build: create tests directory for split builds

When `--disable-dependency-tracking` is in effect with separate build
directory, the tests directory isn't created as a result of the
dependency generation, which leads to a build race for the tests
directory being created and failures:

  Making all in .
  make[2]: Entering directory 'TOPDIR/build/tmp/work/riscv64-yoe-linux-musl/ostree/2019.5-r0/build'
  (echo '[Test]' > tests/test-local-pull-depth.sh.test.tmp; \
  echo 'Type=session' >> tests/test-local-pull-depth.sh.test.tmp; \
  echo 'Exec=env G_TEST_SRCDIR=/usr/libexec/installed-tests/libostree G_TEST_BUILDDIR=/usr/libexec/installed-tests/libostree /usr/libexec/installed-tests/libostree/test-local-pull-depth.sh' >> tests/test-local-pull-depth.sh.test.tmp; \
  mv tests/test-local-pull-depth.sh.test.tmp tests/test-local-pull-depth.sh.test)
  /bin/sh: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  /bin/sh: line 1: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  /bin/sh: line 2: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  mv: cannot stat 'tests/test-local-pull-depth.sh.test.tmp': No such file or directory
  make[2]: *** [Makefile:9282: tests/test-local-pull-depth.sh.test] Error 1

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agolib/kernel-args: Store kernel args as key/value entries
Robert Fairley [Thu, 29 Aug 2019 16:14:26 +0000 (12:14 -0400)]
lib/kernel-args: Store kernel args as key/value entries

Define an `OstreeKernelArgsEntry` structure, which holds
both the key and the value. The kargs order array stores
entries for each key/value pair, instead of just the keys.
The hash table is used to locate entries, by storing
entries in a pointer array for each key. The same public
interface is preserved, while maintaining ordering
information of each key/value pair when
appending/replacing/deleting kargs.

Fixes: #1859
6 years agoMerge pull request #1970 from cgwalters/keyfile-group-not-found
OpenShift Merge Robot [Thu, 7 Nov 2019 21:47:40 +0000 (22:47 +0100)]
Merge pull request #1970 from cgwalters/keyfile-group-not-found

lib/keyfile: Treat "group not found" the same as "key not found"

6 years agolib/keyfile: Treat "group not found" the same as "key not found"
Colin Walters [Thu, 7 Nov 2019 16:06:39 +0000 (16:06 +0000)]
lib/keyfile: Treat "group not found" the same as "key not found"

Prep for fsverity, where I want to create a new group
`[fsverity]` in the keyfile that has default values.  We should
treat the absence of a group the same as absence of a key
in these "with defaults" APIs.

6 years agoMerge pull request #1969 from ricardosalveti/master
OpenShift Merge Robot [Wed, 6 Nov 2019 15:39:59 +0000 (16:39 +0100)]
Merge pull request #1969 from ricardosalveti/master

Makefile: declare ostree_boot_SCRIPTS and append values

6 years agoMakefile: declare ostree_boot_SCRIPTS and append values
Ricardo Salveti [Wed, 6 Nov 2019 00:16:07 +0000 (21:16 -0300)]
Makefile: declare ostree_boot_SCRIPTS and append values

ostree_boot_SCRIPTS was being set on both Makefile-boot.am and
Makefile-switchroot.am, causing the first one to be replaced by the
other at the final Makefile, so declare as empty and append on both
places instead.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
6 years agoMerge pull request #1966 from akiernan/us-musl-tests
OpenShift Merge Robot [Sat, 2 Nov 2019 16:03:37 +0000 (17:03 +0100)]
Merge pull request #1966 from akiernan/us-musl-tests

Fix tests with musl

6 years agoMerge pull request #1965 from akiernan/us-lc-all-en-us
OpenShift Merge Robot [Fri, 1 Nov 2019 18:42:19 +0000 (19:42 +0100)]
Merge pull request #1965 from akiernan/us-lc-all-en-us

tests/core: Fallback to en_US.UTF-8 locale

6 years agotests: Avoid musl failure with `cp -a`
Alex Kiernan [Thu, 31 Oct 2019 17:09:36 +0000 (17:09 +0000)]
tests: Avoid musl failure with `cp -a`

When copying the tree, using musl and GNU coreutils, something gets confused
when setting the ownership of symlinks and the copy fails with:

  cp: failed to preserve ownership for osdata-devel/bin: Not supported

Rework using tar to avoid the problem.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotests/core: Assume C.UTF-8 if locale isn't found
Alex Kiernan [Thu, 31 Oct 2019 11:28:07 +0000 (11:28 +0000)]
tests/core: Assume C.UTF-8 if locale isn't found

When building with musl there's no locale command, also its default
locale is C.UTF-8, so just get C.UTF-8 if we can't find locale.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotests: Handle EPIPE failures when head terminates
Alex Kiernan [Thu, 31 Oct 2019 11:30:00 +0000 (11:30 +0000)]
tests: Handle EPIPE failures when head terminates

When using musl, it appears that the default is line buffered output, so
when `head -1` reads from a pipe we have to handle the source end of the
pipe getting EPIPE.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotests/core: Fallback to en_US.UTF-8 locale
Alex Kiernan [Wed, 30 Oct 2019 07:55:41 +0000 (07:55 +0000)]
tests/core: Fallback to en_US.UTF-8 locale

A number of tests expect explicit left/right single quotes in their
messages, which will never happen in the C locale. Change so we pick a
likely UTF-8 locale, or fail if we can't find one.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoMerge pull request #1963 from cgwalters/release
OpenShift Merge Robot [Wed, 30 Oct 2019 17:46:41 +0000 (18:46 +0100)]
Merge pull request #1963 from cgwalters/release

Release 2019.5

6 years agoPost-release version bump
Colin Walters [Thu, 24 Oct 2019 15:18:45 +0000 (15:18 +0000)]
Post-release version bump

6 years agoRelease 2019.5
Colin Walters [Thu, 24 Oct 2019 15:18:23 +0000 (15:18 +0000)]
Release 2019.5

6 years agoMerge pull request #1962 from jlebon/pr/support-hmac
OpenShift Merge Robot [Wed, 30 Oct 2019 13:20:08 +0000 (14:20 +0100)]
Merge pull request #1962 from jlebon/pr/support-hmac

lib/deploy: Also install HMAC file into /boot

6 years agolib/deploy: Also install HMAC file into /boot
Jonathan Lebon [Tue, 29 Oct 2019 20:45:29 +0000 (16:45 -0400)]
lib/deploy: Also install HMAC file into /boot

To allow for FIPS mode, we need to also install the HMAC file from
`/usr/lib/modules` to `/boot` alongside the kernel image where the
`fips` dracut module will find it. For details, see:

https://github.com/coreos/fedora-coreos-tracker/issues/302

Note I didn't include the file in the boot checksum since it's itself a
checksum of the kernel, so we don't really gain much here other than
potentially causing an unnecessary bootcsum bump.

6 years agoMerge pull request #1953 from uajain/uajain/fix-memory-leak
OpenShift Merge Robot [Tue, 29 Oct 2019 05:26:17 +0000 (06:26 +0100)]
Merge pull request #1953 from uajain/uajain/fix-memory-leak

async-progress: Plug memory leak while destroying GSource

6 years agoMerge pull request #1961 from jlebon/pr/refine-gsource
OpenShift Merge Robot [Mon, 28 Oct 2019 19:58:37 +0000 (20:58 +0100)]
Merge pull request #1961 from jlebon/pr/refine-gsource

lib/pull: Tweak update_timeout logic again

6 years agolib/pull: Tweak update_timeout logic again
Jonathan Lebon [Mon, 28 Oct 2019 18:04:55 +0000 (14:04 -0400)]
lib/pull: Tweak update_timeout logic again

I was hitting `SIGSEGV` when running `cosa build` and narrowed it down
to #1954. What's happening here is that because we're using the default
context, when we unref it in the out path, it may not actually destroy
the `GSource` if it (the context) is still ref'ed elsewhere. So then,
we'd still get events from it if subsequent operations iterated the
context.

This patch is mostly a revert of #1954, except that we still keep a ref
on the `GSource`. That way it is always safe to destroy it afterwards.
(And I've also added a comment to explain this better.)

6 years agoasync-progress: Plug memory leak while destroying GSource
Umang Jain [Fri, 25 Oct 2019 15:28:34 +0000 (20:58 +0530)]
async-progress: Plug memory leak while destroying GSource

See https://gitlab.gnome.org/GNOME/glib/commit/71973c722

6 years agoMerge pull request #1955 from cgwalters/revert-grub2-exit
OpenShift Merge Robot [Fri, 25 Oct 2019 14:07:25 +0000 (16:07 +0200)]
Merge pull request #1955 from cgwalters/revert-grub2-exit

Revert grub2 exit, add new grub2: Honor /boot/.grub2-bls-enabled

6 years agoMerge pull request #1956 from akiernan/us-test-export
OpenShift Merge Robot [Fri, 25 Oct 2019 13:50:49 +0000 (15:50 +0200)]
Merge pull request #1956 from akiernan/us-test-export

tests/export: Guard with check for libarchive

6 years agotests/export: Guard with check for libarchive
Alex Kiernan [Thu, 24 Oct 2019 18:07:30 +0000 (19:07 +0100)]
tests/export: Guard with check for libarchive

If we are built without libarchive support, this test fails:

  error: This version of ostree is not compiled with libarchive support
  ...
  ERROR: tests/test-export.sh - too few tests run (expected 5, got 0)
  ERROR: tests/test-export.sh - exited with status 1

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoRevert "grub2: Exit gracefully if the configuration has BLS enabled"
Colin Walters [Thu, 24 Oct 2019 15:21:17 +0000 (15:21 +0000)]
Revert "grub2: Exit gracefully if the configuration has BLS enabled"

This reverts commit 985a14100295c99d0c6d712bfbee0ec52a3a1601.
It turned out that some people have old bootloaders, and hence
get the "no entries" problem.  That's much, much much worse
than double entries.

6 years agoMerge pull request #1954 from jlebon/pr/update-timeout
OpenShift Merge Robot [Wed, 23 Oct 2019 16:02:30 +0000 (18:02 +0200)]
Merge pull request #1954 from jlebon/pr/update-timeout

lib/pull: Avoid calling destroy on unref'ed GSource

6 years agoMerge pull request #1952 from cgwalters/trivial-rename
OpenShift Merge Robot [Wed, 23 Oct 2019 15:53:27 +0000 (17:53 +0200)]
Merge pull request #1952 from cgwalters/trivial-rename

build-sys: Rename internal conditionals for trivial-httpd

6 years agolib/pull: Avoid calling destroy on unref'ed GSource
Jonathan Lebon [Wed, 23 Oct 2019 15:04:00 +0000 (11:04 -0400)]
lib/pull: Avoid calling destroy on unref'ed GSource

We're creating the timer source and then passing ownership to the
context, but because we didn't free the pointer, we would still call
`g_source_destroy` in the exit path. We'd do this right after doing
`unref` on the context too, which would have already destroyed and
unref'ed the source.

Drop that and just restrict the scope of that variable down to make
things more obvious.

Just noticed this after reviewing #1953.

6 years agobuild-sys: Cleanup handling for trivial-httpd-cmdline
Colin Walters [Mon, 21 Oct 2019 21:45:20 +0000 (21:45 +0000)]
build-sys: Cleanup handling for trivial-httpd-cmdline

This way it's clearer this bit is only about the CLI entrypoint
also living in `ostree trivial-httpd`, not the underlying
`ostree-trivial-httpd` binary that's separate now.

Delete the automake conditional for this, and make the manpage
conditional use `if USE_LIBSOUP` the same way the C build does.

Suggested-by: Jonathan Lebon <jonathan@jlebon.com>
6 years agoMerge pull request #1950 from akiernan/us-revert-trivial-httpd
OpenShift Merge Robot [Mon, 21 Oct 2019 21:43:22 +0000 (23:43 +0200)]
Merge pull request #1950 from akiernan/us-revert-trivial-httpd

Revert trivial httpd changes (#1912)

6 years agoRevert "Always enable trivial-httpd for tests"
Alex Kiernan [Sat, 19 Oct 2019 21:20:27 +0000 (22:20 +0100)]
Revert "Always enable trivial-httpd for tests"

This reverts commit 82699a67dbb6bfcc9452bb969e7872809232a84f.

6 years agoRevert "Gate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD"
Alex Kiernan [Sat, 19 Oct 2019 21:20:25 +0000 (22:20 +0100)]
Revert "Gate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD"

This reverts commit 83d44ac20ae80d74e05d89744fd1fbd4f45b7fba.

6 years agoMerge pull request #1947 from cgwalters/more-scan-build-2
OpenShift Merge Robot [Fri, 18 Oct 2019 18:59:06 +0000 (20:59 +0200)]
Merge pull request #1947 from cgwalters/more-scan-build-2

More scan build 2

6 years agoMerge pull request #1949 from dbnicholson/no-g-gnuc-function
OpenShift Merge Robot [Fri, 18 Oct 2019 17:56:14 +0000 (19:56 +0200)]
Merge pull request #1949 from dbnicholson/no-g-gnuc-function

repo: Stop using deprecated G_GNUC_FUNCTION

6 years agorepo: Stop using deprecated G_GNUC_FUNCTION
Dan Nicholson [Fri, 18 Oct 2019 17:10:44 +0000 (11:10 -0600)]
repo: Stop using deprecated G_GNUC_FUNCTION

In glib 2.62 this has been changed to emitting a warning. Use G_STRFUNC
instead, which has been available for a long time and is already used in
other places in ostree.

6 years agolib/checksum-utils: Use g_memdup()
Colin Walters [Fri, 18 Oct 2019 15:06:51 +0000 (15:06 +0000)]
lib/checksum-utils: Use g_memdup()

This is clearer and silences a scan-build warning.

6 years agotests: [scan-build] Initialize a variable
Colin Walters [Fri, 18 Oct 2019 14:57:47 +0000 (14:57 +0000)]
tests: [scan-build] Initialize a variable

False positive.

6 years agolib: Port variant-builder.c to new style
Colin Walters [Fri, 18 Oct 2019 14:56:51 +0000 (14:56 +0000)]
lib: Port variant-builder.c to new style

Seeing `scan-build` warning here, prep for fixing it.

6 years agotests: Port keyfile test to new style
Colin Walters [Fri, 18 Oct 2019 14:48:44 +0000 (14:48 +0000)]
tests: Port keyfile test to new style

Just noticed in passing.

6 years agolib/pull: [scan-build] Silence a dead store warning
Colin Walters [Fri, 18 Oct 2019 14:48:25 +0000 (14:48 +0000)]
lib/pull: [scan-build] Silence a dead store warning

This one was actual duplicate code.

6 years agolib/repo: [scan-build] Quiet a dead store warning
Colin Walters [Fri, 18 Oct 2019 14:45:33 +0000 (14:45 +0000)]
lib/repo: [scan-build] Quiet a dead store warning

False positive, just add a pacifier.

6 years agotree-wide: [scan-build] Fix some dead stores
Colin Walters [Wed, 16 Oct 2019 19:36:31 +0000 (19:36 +0000)]
tree-wide: [scan-build] Fix some dead stores

No real issues, just quieting the scanner.

6 years agoMerge pull request #1945 from cgwalters/papr-trim
OpenShift Merge Robot [Wed, 16 Oct 2019 21:12:34 +0000 (23:12 +0200)]
Merge pull request #1945 from cgwalters/papr-trim

ci: Trim PAPR config to drop required flag

6 years agoMerge pull request #1943 from cgwalters/more-scan-build
OpenShift Merge Robot [Wed, 16 Oct 2019 18:44:15 +0000 (20:44 +0200)]
Merge pull request #1943 from cgwalters/more-scan-build

More scan build

6 years agoci: Trim PAPR config to drop required flag
Colin Walters [Wed, 16 Oct 2019 18:38:37 +0000 (18:38 +0000)]
ci: Trim PAPR config to drop required flag

Same as https://github.com/coreos/rpm-ostree/pull/1923
Quoting that rationale:

> Since we're not using Homu anymore (and Tide instead looks at
> all statuses by default), let's just drop it. This brings down the
> number of statuses on PRs by one more (and so one less context to
> override when needed).

6 years agoMerge pull request #1912 from akiernan/us-fix-trivial-httpd
OpenShift Merge Robot [Wed, 16 Oct 2019 18:15:56 +0000 (20:15 +0200)]
Merge pull request #1912 from akiernan/us-fix-trivial-httpd

Gate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD

6 years agoMerge pull request #1937 from cgwalters/zipl-backend
OpenShift Merge Robot [Wed, 16 Oct 2019 15:21:10 +0000 (17:21 +0200)]
Merge pull request #1937 from cgwalters/zipl-backend

 bootloader: Add a zipl bootloader backend

6 years agoMerge pull request #1931 from cgwalters/covscan-fixes
OpenShift Merge Robot [Wed, 16 Oct 2019 15:05:31 +0000 (17:05 +0200)]
Merge pull request #1931 from cgwalters/covscan-fixes

libotutil: Port keyfile-utils.c to new style

6 years agoMerge pull request #1942 from cgwalters/build-installdeps
OpenShift Merge Robot [Wed, 16 Oct 2019 14:24:57 +0000 (16:24 +0200)]
Merge pull request #1942 from cgwalters/build-installdeps

ci: Skip all yum operations if SKIP_INSTALLDEPS is set

6 years agobootloader: Add a zipl bootloader backend
Colin Walters [Mon, 14 Oct 2019 19:22:19 +0000 (19:22 +0000)]
bootloader: Add a zipl bootloader backend

zipl is a bit special in that it parses the BLS config files
directly *but* we need to run the command to update the "boot block".

Hence, we're not generating a separate config file like the other
backends.  Instead, extend the bootloader interface with a `post_bls_sync`
method that is run in the same place we swap the `boot/loader` symlink.

We write a "stamp file" in `/boot` that says we need to run this command.
The reason we use stamp file is to prevent the case where the system is
interrupted after BLS file is updated, but before zipl is triggered,
then zipl boot records are not updated.
This opens the door to making things eventually-consistent/reconcilable
by later adding a systemd unit to run `zipl` if we're interrupted via
a systemd unit - I think we should eventually take this approach
everywhere rather than requiring `/boot/loader` to be a symlink.

Author: Colin Walters <walters@verbum.org>
Tested-by: Tuan Hoang <tmhoang@linux.ibm.com>
Co-Authored-By: Tuan Hoang <tmhoang@linux.ibm.com>
6 years agoprune: [scan-build] Initialize a variable
Colin Walters [Wed, 16 Oct 2019 13:48:20 +0000 (13:48 +0000)]
prune: [scan-build] Initialize a variable

Another false positive because we only read this if `opt_keep_younger_than` is `TRUE`,
but let's initialize variables on general principle.

6 years agotree-wide: [scan-build]: Add some asserts that pointers are non-NULL
Colin Walters [Wed, 16 Oct 2019 13:44:46 +0000 (13:44 +0000)]
tree-wide: [scan-build]: Add some asserts that pointers are non-NULL

More "scan-build doesn't understand GError and our out-param conventions"
AKA "these errors would be impossible with Rust's sum type Result<> approach".

6 years agocommit: [scan-build] Remove a dead assignment
Colin Walters [Wed, 16 Oct 2019 13:38:29 +0000 (13:38 +0000)]
commit: [scan-build] Remove a dead assignment

The `write_commit()` API defaults to current time, and
this assignment became dead in:
https://github.com/ostreedev/ostree/commit/8ba90a33410c9707a30a77f808a7ec712d465165

6 years agoci: Skip all yum operations if SKIP_INSTALLDEPS is set
Colin Walters [Wed, 16 Oct 2019 13:32:36 +0000 (13:32 +0000)]
ci: Skip all yum operations if SKIP_INSTALLDEPS is set

This is used by our OpenShift Prow job; we use the
cosa buildroot container:

https://github.com/coreos/coreos-assembler/pull/730

And using `yum` at all means we can flake on fetching rpm metadata.

6 years agolibotutil: Port keyfile-utils.c to new style
Colin Walters [Mon, 14 Oct 2019 13:19:28 +0000 (13:19 +0000)]
libotutil: Port keyfile-utils.c to new style

I was trying to fix a clang `scan-build` error that jlebon
ended up tracking down in
https://github.com/ostreedev/ostree/pull/1939/commits/9344de1ce1e8c185e01988277606ba1ed7f9d16b

But in the process of tracing through this I found it
way easier to read as "new style" code, so this also ports the
code.

I added a `g_assert()` in there too to help assert that
`g_key_file_get_value` won't leak in the error path.

6 years agoMerge pull request #1932 from cgwalters/covscan-fixes-2
OpenShift Merge Robot [Tue, 15 Oct 2019 17:56:54 +0000 (19:56 +0200)]
Merge pull request #1932 from cgwalters/covscan-fixes-2

libostree: Add an assert to pacify clang-analyzer

6 years agoMerge pull request #1939 from jlebon/pr/fix-keyfile-leak
OpenShift Merge Robot [Tue, 15 Oct 2019 17:13:56 +0000 (19:13 +0200)]
Merge pull request #1939 from jlebon/pr/fix-keyfile-leak

src/libotutil: Fix strv memory leak

6 years agosrc/libotutil: Fix strv memory leak
Jonathan Lebon [Tue, 15 Oct 2019 15:56:34 +0000 (11:56 -0400)]
src/libotutil: Fix strv memory leak

We were only freeing the array and not the members.

Caught by `clang-analyzer` in:
https://github.com/ostreedev/ostree/pull/1931

6 years agoMerge pull request #1933 from cgwalters/scan-build-0
OpenShift Merge Robot [Tue, 15 Oct 2019 15:59:00 +0000 (17:59 +0200)]
Merge pull request #1933 from cgwalters/scan-build-0

A few more scan-build fixes

6 years agorepo: [scan-build]: Mark a variable used
Colin Walters [Mon, 14 Oct 2019 14:24:18 +0000 (14:24 +0000)]
repo: [scan-build]: Mark a variable used

We're just using this to auto-free, quiet the static analysis.

6 years agosysroot: [scan-build] Remove a dead assignment
Colin Walters [Mon, 14 Oct 2019 14:22:12 +0000 (14:22 +0000)]
sysroot: [scan-build] Remove a dead assignment

Just quieting the scan.

6 years agosysroot: [scan-build]: Remove a dead assignment
Colin Walters [Mon, 14 Oct 2019 14:20:44 +0000 (14:20 +0000)]
sysroot: [scan-build]: Remove a dead assignment

Clarify the conditionals here and remove a dead assignment.

6 years agorepo: [scan-build] Initialize a variable
Colin Walters [Mon, 14 Oct 2019 14:17:09 +0000 (14:17 +0000)]
repo: [scan-build] Initialize a variable

Another GLib error convention issue; but eh, we might as
well be conservative and always initialize variables.

6 years agolibostree: Add an assert to pacify clang-analyzer
Colin Walters [Mon, 14 Oct 2019 13:25:46 +0000 (13:25 +0000)]
libostree: Add an assert to pacify clang-analyzer

Got this error when trying to rebase libostree in RHEL:

```
Error: CLANG_WARNING: [#def1]
libostree-2019.2/src/libostree/ostree-repo-checkout.c:375:21: warning: Access to field 'disable_xattrs' results in a dereference of a null pointer (loaded from variable 'repo')
```

I think what's happening is it sees us effectively testing
`if (repo == NULL)` via the `while (current_repo)`.  Let's
tell it we're sure it's non-null right after the loop.

6 years agoMerge pull request #1938 from cgwalters/owners-file
Colin Walters [Mon, 14 Oct 2019 20:29:05 +0000 (16:29 -0400)]
Merge pull request #1938 from cgwalters/owners-file

OWNERS: New file

6 years agoOWNERS: New file
Colin Walters [Mon, 14 Oct 2019 19:47:23 +0000 (19:47 +0000)]
OWNERS: New file

I tried to balance reflecting the reality of who works on libostree
today with keeping some of the existing committers - particularly
committers from multiple organizations.

Part of switching libostree over to OpenShift Prow.

6 years agoMerge pull request #1934 from cgwalters/mkdir-artifacts
Colin Walters [Mon, 14 Oct 2019 14:59:31 +0000 (10:59 -0400)]
Merge pull request #1934 from cgwalters/mkdir-artifacts

ci: Make ${ARTIFACTS} directory

6 years agoci: Make ${ARTIFACTS} directory
Colin Walters [Mon, 14 Oct 2019 14:29:31 +0000 (14:29 +0000)]
ci: Make ${ARTIFACTS} directory

It may not exist in OpenShift Prow by default.

6 years agoci: Honor ARTIFACTS environment variable
Colin Walters [Fri, 11 Oct 2019 20:25:48 +0000 (20:25 +0000)]
ci: Honor ARTIFACTS environment variable

This is set by the OpenShift Prow pod-utils:
https://github.com/openshift/test-infra/blob/master/prow/pod-utilities.md

Prep for having OSTree use that.

Closes: #1930
Approved by: jlebon

6 years agoGate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD
Alex Kiernan [Thu, 5 Sep 2019 12:22:15 +0000 (13:22 +0100)]
Gate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD

When building without --enable-trivial-httpd-cmdline, don't build or install
the ostree-trivial-httpd binary.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoAlways enable trivial-httpd for tests
Alex Kiernan [Wed, 4 Sep 2019 16:29:15 +0000 (17:29 +0100)]
Always enable trivial-httpd for tests

When running tests we always need ostree-trivial-httpd, so enable it
unconditionally

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agogrub2: Exit gracefully if the configuration has BLS enabled
Javier Martinez Canillas [Thu, 26 Sep 2019 15:33:57 +0000 (17:33 +0200)]
grub2: Exit gracefully if the configuration has BLS enabled

Since Fedora 30 grub2 has support to populate its menu entries from the
BootLoaderSpec fragments in /boot/loader/entries, so there's no need to
generate menu entries anymore using the /etc/grub.d/15_ostree script.

But since ostree doesn't update the bootloader, it may be that the grub2
installed is an old one that doesn't have BLS support.

For new installs, GRUB_ENABLE_BLSCFG=true is set in /etc/default/grub to
tell the /etc/grub.d/10_linux script if a blscfg command has to be added
to the generated grub2 config file.

So check if BLS is enabled in /etc/default/grub and only add the entries
if that's not the case. Otherwise the menu entries will be duplicated.

The approach has the drawback that if a user sets GRUB_ENABLE_BLSCFG=true
in /etc/default/grub without updating grub2, they will get an empty menu.
Since there won't be any entries created by the 30_ostree script and the
blscfg command won't work on the older grub2.

Unfortunately there is no way to know if the installed grub2 already has
BLS support or not.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751272#c27

Closes: #1929
Approved by: jlebon

6 years agoconfigure.ac: Add more details on how to do a release
Jonathan Lebon [Wed, 25 Sep 2019 15:27:38 +0000 (11:27 -0400)]
configure.ac: Add more details on how to do a release

Closes: #1928
Approved by: cgwalters

6 years agoPost-release version bump
Jonathan Lebon [Wed, 25 Sep 2019 13:39:19 +0000 (09:39 -0400)]
Post-release version bump

Closes: #1927
Approved by: cgwalters

6 years agoRelease 2019.4
Jonathan Lebon [Wed, 25 Sep 2019 13:37:48 +0000 (09:37 -0400)]
Release 2019.4

Tiny release. Just want to get out the important bugfixes instead of
backporting patches (notably the gpg-agent stuff and
`ostree-finalize-staged.service` ordering).

Closes: #1927
Approved by: cgwalters

6 years agoboot/finalize-staged: Run after systemd-journal-flush.service
Jonathan Lebon [Tue, 24 Sep 2019 21:08:54 +0000 (17:08 -0400)]
boot/finalize-staged: Run after systemd-journal-flush.service

In Fedora 31, `systemd-journal-flush.service` uses a new
`--smart-relinquish-var` switch which fixes the
`umount: /var: target is busy` bug by telling journald to stop logging
to `/var` and back to `/run` again during shutdown.

This interacted with `ostree-finalize-staged.service` in a tricky way:
since we weren't strongly ordered against it, when we happened to
finalize after `/var` is relinquished, we never persisted the output
from that service to disk. This then threw off `rpm-ostree status` when
trying to find the completion message to know that finalization went
well.

Just fix this by adding an explicit `After=` on that unit. That way we
shut down *before* `systemd-journal-flush.service` (the `/var`
relinquish bit happens in its `ExecStop=`).

For more info, see:
https://github.com/systemd/systemd/commit/3ff7a50d66e3f851d3d9f132b740a7fb2055aa1d
https://github.com/systemd/systemd/commit/1e187d2dd52cbb4f0bb30e4d96acf7f72a145b91
https://bugzilla.redhat.com/show_bug.cgi?id=1751272

Closes: #1926
Approved by: cgwalters